using System;
using System.ComponentModel.DataAnnotations;

namespace Work.Domain
{
    /// <summary>
    /// 处方明细（药品信息）
    /// </summary>
    public class PrescriptionItem
    {
        /// <summary>
        /// 处方明细ID
        /// </summary>
        [Key]
        public int PrescriptionItemId { get; set; }

        /// <summary>
        /// 预约编号（外键）
        /// </summary>
        public int AppointmentId { get; set; }

        /// <summary>
        /// 病历编号（外键，可选）
        /// </summary>
        public int? RecordId { get; set; }

        /// <summary>
        /// 就诊人编号（外键，冗余字段，便于查询）
        /// </summary>
        public int PatientId { get; set; }

        /// <summary>
        /// 挂单号（冗余字段，便于查询）
        /// </summary>
        public string? RegistrationNum { get; set; }

        /// <summary>
        /// 药品名称
        /// </summary>
        public string? MedicineName { get; set; }

        /// <summary>
        /// 单价
        /// </summary>
        public decimal UnitPrice { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public int Quantity { get; set; }

        /// <summary>
        /// 总金额（单价 × 数量）
        /// </summary>
        public decimal TotalAmount { get; set; }

        /// <summary>
        /// 支付状态（未支付/已支付）
        /// </summary>
        public string? PaymentStatus { get; set; }

        /// <summary>
        /// 开药时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 开药医生（可选）
        /// </summary>
        public string? CreateBy { get; set; }

        // 导航属性
        /// <summary>
        /// 关联的预约信息
        /// </summary>
        public virtual Appintment? Appointment { get; set; }

        /// <summary>
        /// 关联的病历信息
        /// </summary>
        public virtual MedicalRecord? MedicalRecord { get; set; }

        /// <summary>
        /// 关联的患者信息
        /// </summary>
        public virtual Patient? Patient { get; set; }
    }
}

